Repository navigation
fix(notify): start the Windows tray at logon without a console - #349
Merged
Merged
Conversation
service install --notify wrote the bare berth.exe to the user's Run key. berth.exe is a console program, so a console opened at every logon, and closing it sent CTRL_CLOSE_EVENT and ended the tray. The Run value is now wscript on a berth-notify.vbs stub, the launcher the other units use: no console, berth notify runs hidden, and its output goes to logs\berth-notify.log. Uninstall removes the stub with the Run value. Closes #344
…-at-logon # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #344.
What changes
berth service install --notifywrote the bareberth.exe notifytoHKCU\...\Run\BerthNotify.berth.exeis a console program, so a console opened at every logon. Closing that window sentCTRL_CLOSE_EVENTand ended the tray.The Run value is now
wscript.exe //B //Nologo "<state>\units\berth-notify.vbs". This is the hidden launcher the daemon, gateway and harbor tasks already use. No console opens, and the tray's output goes tologs\berth-notify.log.service uninstalldeletes the stub along with the Run value. You need to run the install again to replace an older Run value.This keeps one binary. A separate
-H windowsguibuild for the tray would need a second exe, because the CLI needs console stdio.Proof
TestNotifyAtLogonStartsTheTrayHidden(Windows only) checks that the Run value is wscript on the stub, not the exe, and that the stub runsberth.exe notifyhidden with its output going to the log. It does not build without the change. I ran it under wine together with the existingTestServiceInstallWindows*andTestServiceUninstallWindows*tests, and all of them passed. ThewindowsCI job runs it on Windows.go test ./..., the Windows build and vet, golangci-lint 2.14.0.